package com.yixun.qfbao.job;

import com.yixun.qfbao.api.service.CPReportService;
import com.yixun.qfbao.api.service.JobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 一句话功能简述〉 〈功能详细描述〉
 * 将超出报备有效期的报备置为无效
 * @author jhsong
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Component
public class OverReportValidTimeJob {
	private static Logger logger = LoggerFactory.getLogger(OverReportValidTimeJob.class);

	@Autowired
	private JobService jobService;

	@Scheduled(cron = "0 */2 * * * ?")
	public void overReportedTime() {
		logger.info("将超出报备有效期的报备置为无效..........job start");
		logger.info("overReportedTime 成功触发报备超时定时任务！");
		//关掉掉报备保护时间job
		int count = jobService.overReporValidTimeJob();
		if(count > 1){
			logger.info("将超出报备有效期的报备置为无效成功..........更新数量：{}" + count);
		}
		logger.info("将超出报备有效期的报备置为无效..........job end");
	}
}
